<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright 2011 KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 * @version    $Id: object-rate-small.tpl 2011-03-09 01:11:30 idris $
 * @author     Idris
 */
?>
  
<?php
$guid = $this->object->getGuid();
$rand = rand(0, 1000);
$id = 'rating'.$rand.'-'.$guid;
?>

<script type="text/javascript">
<?php if ($this->runonce): ?>
en4.core.runonce.add(function() {
<?php endif; ?>
  
  if (!en4.kowcore.rates) {
    en4.kowcore.rates = [];
  }
  
  en4.kowcore.rates.push(new en4.kowcore.rating({
    'guid': '<?php echo $guid; ?>',
    'score': <?php echo round($this->score, 2); ?>,
    'count': <?php echo (int)$this->count; ?>,
    'containerId': '<?php echo $id; ?>',
    'isAllowed': <?php echo (int)$this->isAllowed; ?>,
    'details': <?php echo (int)$this->details; ?>
  }));
<?php if ($this->runonce): ?>
});
<?php endif; ?>
</script>

<div class="kowcore-rating-small" id="<?php echo $id; ?>">
  
  <div class="stars">
    <a href="javascript:void(0)" class="star first-half empty">0.5</a>
    <a href="javascript:void(0)" class="star second-half empty">1</a>
    <a href="javascript:void(0)" class="star first-half empty">1.5</a>
    <a href="javascript:void(0)" class="star second-half empty">2</a>
    <a href="javascript:void(0)" class="star first-half empty">2.5</a>
    <a href="javascript:void(0)" class="star second-half empty">3</a>
    <a href="javascript:void(0)" class="star first-half empty">3.5</a>
    <a href="javascript:void(0)" class="star second-half empty">4</a>
    <a href="javascript:void(0)" class="star first-half empty">4.5</a>
    <a href="javascript:void(0)" class="star second-half empty">5</a>
    <div class="clr"></div>
  </div>

  <?php if ($this->details): ?>
  <div class="score">
    <div class="detail">
      <a href="javascript:void(0)" class="kow-tip-hint current"><?php echo round($this->score, 2); ?></a>
      <div class="kow-tip-text hidden"><?php echo $this->translate('Current score'); ?></div>
    </div>

    <div class="detail delimiter"> / </div>

    <div class="detail">
      <a href="javascript:void(0)" class="kow-tip-hint max">5</a>
      <div class="kow-tip-text hidden"><?php echo $this->translate('Max score'); ?></div>
    </div>

    <div class="detail delimiter"> | </div>

    <div class="detail">
      <a href="<?php echo $this->url(array('controller' => 'list', 'action' => 'rates', 'format' => 'smoothbox', 'guid' => $guid), 'kowcore_extended'); ?>" class="kow-tip-hint count smoothbox"><?php echo $this->count; ?></a>
      <div class="kow-tip-text hidden"><?php echo $this->translate('Count of votes'); ?></div>
    </div>
    
    <div class="clr"></div>
    
  </div>
  <?php endif; ?>
  
  <div class="clr"></div>
</div>
<div class="clr"></div>